print("包含中文的str")

a = ord('a')
print(a)

b = ord("A")
print(b)

n = chr(66)
m = n
n = chr(66+1)
print(n,'\n')
print(m,'\n')

#str变为字节 bytes
x=b'ABC'
print(x,'\n')

y= '中文'.encode('utf-8')
print(y,'\n')

#asci= '中文'.encode('ascii')  中文不能用ASCII
#print(asci,'\n')

asci= 'zhongwen'.encode('ascii')  #纯英文才可以用ASCII
print(asci,'\n')

#bytes变为str
s1=b'ABC'.decode('ascii')
print(s1,'\n')

s2=b'\xe4\xb8\xad\xe6\x96\x87'.decode('utf-8')
print(s2)

s3= b'\xe4\xb8\xad\xff'.decode('utf-8',errors='ignore') #忽略错误
print(s3)